package views;

import java.awt.Rectangle;
import java.awt.event.*;

import javax.swing.ButtonGroup;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;

public class Person_Upload 
{
	private static final long serialVersionUID = 1L;

	private JFrame jFrame = null;  //  @jve:decl-index=0:visual-constraint="10,10"

	private JPanel jContentPane = null;

	private JLabel headingLabel = null;
	
	private JLabel headingLabel_2 = null;
	
	private JLabel headingLabel_3 = null;
	
	private JLabel headingLabel_4 = null;
	
	private JLabel headingLabel_5 = null;
	
	private JLabel headingLabel_6 = null;
	
	private JLabel headingLabel_7 = null;
	
	private JLabel headingLabel_8 = null;
	
	private JTextField textField_1 = null;
	
	private JTextField textField_2 = null;
	
	private JTextField textField_3 = null;
	
	private JTextField textField_4 = null;
	
	private JTextField textField_5 = null;
	
	private ButtonGroup gender = null;
	
	private JRadioButton maleButton = null;
	
	private JRadioButton femaleButton = null;
	
	private JRadioButton transgenderButton = null;

	private JTextArea descriptionTextArea = null;
	
	private JScrollPane scrollPane = null;
	
	private JButton saveButton = null;
	
	private JButton resetButton = null;
	
	private JButton cancelButton = null;

	public Person_Upload()
	{	
		getJFrame().setVisible(true);
	}
	
	private JFrame getJFrame() 
	{
		if (jFrame == null) 
		{
			jFrame = new JFrame();
			jFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
			jFrame.setSize(450, 400);
			jFrame.setContentPane(getJContentPane());
			jFrame.setTitle("Person Upload/Edit");
			jFrame.setLocationRelativeTo(null);
		}
		return jFrame;
	}

	private JPanel getJContentPane() 
	{
		if (jContentPane == null) 
		{
			headingLabel = new JLabel();
			headingLabel.setBounds(new Rectangle(10, 10, 400, 20));
			headingLabel.setText("Person Upload/Edit");
			
			headingLabel_2 = new JLabel();
			headingLabel_2.setBounds(new Rectangle(10, 40, 400, 20));
			headingLabel_2.setText("Person ID:");
			
			textField_1 = new JTextField();
			textField_1.setBounds(200, 40, 50, 20);
			textField_1.setEnabled(false);
			
			headingLabel_3 = new JLabel();
			headingLabel_3.setBounds(new Rectangle(10, 65, 400, 20));
			headingLabel_3.setText("First Name:");
			
			textField_2 = new JTextField();
			textField_2.setBounds(200, 65, 100, 20);
			
			headingLabel_4 = new JLabel();
			headingLabel_4.setBounds(new Rectangle(10, 90, 400, 20));
			headingLabel_4.setText("Last Name:");
			
			textField_3 = new JTextField();
			textField_3.setBounds(200, 90, 100, 20);
			
			headingLabel_5 = new JLabel();
			headingLabel_5.setBounds(new Rectangle(10, 115, 400, 20));
			headingLabel_5.setText("Employee ID:");
			
			textField_4 = new JTextField();
			textField_4.setBounds(200, 115, 100, 20);
			
			headingLabel_6 = new JLabel();
			headingLabel_6.setBounds(new Rectangle(10, 140, 400, 20));
			headingLabel_6.setText("Job Title:");
			
			textField_5 = new JTextField();
			textField_5.setBounds(200, 140, 100, 20);
			
			headingLabel_7 = new JLabel();
			headingLabel_7.setBounds(new Rectangle(10, 165, 400, 20));
			headingLabel_7.setText("Gender:");
			
			gender = new ButtonGroup();
			
			maleButton = new JRadioButton();
			maleButton.setText("Male");
			maleButton.setBounds(200, 165, 60, 20);
			
			femaleButton = new JRadioButton();
			femaleButton.setText("Female");
			femaleButton.setBounds(260, 165, 80, 20);
			
			transgenderButton = new JRadioButton();
			transgenderButton.setText("Transgender");
			transgenderButton.setBounds(340, 165, 120, 20);
			
			gender.add(maleButton);
			gender.add(femaleButton);
			gender.add(transgenderButton);
			
			headingLabel_8 = new JLabel();
			headingLabel_8.setBounds(new Rectangle(10, 190, 400, 20));
			headingLabel_8.setText("Description:");
			
			descriptionTextArea = new JTextArea();
			descriptionTextArea.setBounds(new Rectangle(200, 190, 200, 100));
			descriptionTextArea.setLineWrap(true);
			descriptionTextArea.setWrapStyleWord(true);
			
			scrollPane = new JScrollPane (descriptionTextArea);
			scrollPane.setBounds(200, 190, 200, 100);
			
			saveButton = new JButton();
			saveButton.setText("Save");
			saveButton.setBounds(150, 320, 80, 30);
			saveButton.addActionListener(new ActionListener()
			{
				public void actionPerformed(ActionEvent e) 
				{
					JOptionPane.showMessageDialog(null, "Save Button");
					
				}	
			});
			
			resetButton = new JButton();
			resetButton.setText("Reset");
			resetButton.setBounds(250, 320, 80, 30);
			resetButton.addActionListener(new ActionListener()
			{
				public void actionPerformed(ActionEvent e) 
				{
					resetFields();
					
				}	
			});
			
			cancelButton = new JButton();
			cancelButton.setText("Cancel");
			cancelButton.setBounds(350, 320, 80, 30);
			cancelButton.addActionListener(new ActionListener()
			{
				public void actionPerformed(ActionEvent e) 
				{
					cancelWindow();
					
				}	
			});
			
			jContentPane = new JPanel();
			jContentPane.setLayout(null);
			jContentPane.add(headingLabel, null);
			jContentPane.add(headingLabel_2, null);
			jContentPane.add(headingLabel_3, null);
			jContentPane.add(headingLabel_4, null);
			jContentPane.add(headingLabel_5, null);
			jContentPane.add(headingLabel_6, null);
			jContentPane.add(headingLabel_7, null);
			jContentPane.add(headingLabel_8, null);
			jContentPane.add(textField_1, null);
			jContentPane.add(textField_2, null);
			jContentPane.add(textField_3, null);
			jContentPane.add(textField_4, null);
			jContentPane.add(textField_5, null);
			jContentPane.add(maleButton, null);
			jContentPane.add(femaleButton, null);
			jContentPane.add(transgenderButton, null);
			jContentPane.add(scrollPane, null);
			jContentPane.add(saveButton, null);
			jContentPane.add(resetButton, null);
			jContentPane.add(cancelButton, null);
		}
		return jContentPane;
	}

	private void resetFields()
	{
		textField_1.setText("");
		textField_2.setText("");
		textField_3.setText("");
		textField_4.setText("");
		textField_5.setText("");
		//gender.clearSelection();
		descriptionTextArea.setText("");
	}
	
	private void cancelWindow()
	{
		jFrame.setVisible(false);
		jFrame.dispose();
	}



}
